/*
 * @Author: taoyuqing
 * @Date: 2023-03-08 23:23:28
 * @Description: 
 */
class MinesArray {
  factor(n) {
    if (n == 0) {
      return 1;
    }
    return n * factor(n - 1);
  }

  tempFunc(n, r) {
    return factor(n) / factor(r) / factor(n - r);
  }

  calculateMultiplier(mines, coins) {
    return changeTwoDecimal_f(
        0.95 * tempFunc(25, coins) / tempFunc(25 - mines, coins));
  }

  changeTwoDecimal_f(x) {
    var f_x = double.parse('$x');
    f_x = (f_x * 100) / 100;
    // f_x = f_x.truncateToDouble();
    var s_x = f_x.toString();
    var pos_decimal = s_x.indexOf('.');
    if (pos_decimal < 0) {
      pos_decimal = s_x.length;
      s_x += '.';
    }
    while (s_x.length <= pos_decimal + 2) {
      s_x += '0';
    }
    return s_x;
  }

  getOutPutArr() {
    List outPut = [];
    for (int mines = 1; mines <= 24; mines++) {
      var grid = [];
      for (int i = 1; i <= 25 - mines; i++) {
        // grid[i] = calculateMultiplier(mines, i);
        grid.add(calculateMultiplier(mines, i));
      }
      outPut.add(grid);
    }
    return outPut;
  }
}
